<?php
namespace Admin\Controller;

class AuthorController extends CommonController {
    public function index(){
        $this->assign('title','视频作者管理');
        $list = M('author');
        $data = $list->select();
        $this->assign('data',$data);
        $this->show();
    }
    public function edit(){
        $info = M('author');
        $data['a_name'] = $_POST['a_name'];
        $data['a_id'] = $_POST['a_id'];
        // var_dump($_POST);
        // var_dump($data);die;
        $re = $info->save($data);
        echo json_encode($re);
    }
    public function d(){
        $author = M('author');
        $re = $author->delete($_POST['a_id']);
        echo json_encode(1);
    }
    public function add(){
        $author = M('author');
        $author->create();
        $re = $author->add();
        echo json_encode($re);
    }
     public function e(){
        $info = M('author');
        $id = $_POST['id'];
        $data['a_status'] = $_POST['up'];
        $info->where('a_id="'.$id.'"')->save($data);
    }
}   